﻿namespace GoodAdmin.Web.Core;


/// <summary>
/// 配置信息控制器
/// </summary>
[ApiDescriptionSettings("System", Tag = "配置管理")]
[Route("system/config")]
public class ConfigController: IDynamicApiController
{
    private readonly IConfigService _configService;

    public ConfigController(IConfigService configService)
	{
        _configService = configService;
    }

    #region  GET

    /// <summary>
    /// 获取系统配置
    /// </summary>
    /// <returns></returns>
    [HttpGet("getSystemConfig")]
    [DisplayName("获取系统配置")]
    public async Task<ConfigOutput> GetSystemConfig()
    {
        return await _configService.GetSystemConfig();
    }

    #endregion

    #region POST

    /// <summary>
    /// 更新系统配置
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("updateSystemConfig")]
    [DisplayName("更新系统配置")]
    public async Task UpdateSystemConfig(SystemConfigUpdateInput input)
    {
        await _configService.UpdateSystemConfig(input);
    }
    #endregion
}